<!DOCTYPE html>
<html lang="en">
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:float="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>注册界面</title>
    <script type="text/javascript" src="/static/js/jquery-3.2.1.min.js"></script>
</head>
<body>
<DIV th:unless="${havecode}">

    <form method="post" action="/user/createcode" >
        邮箱：<input type="text" name="email"  /><br>
        <input type="submit" value="获取验证码">
    </form>
</DIV>

<DIV th:if="${havecode}">

    <form method="post" action="/user/clientregister" >
        邮箱：<input type="text" name="email" /><br>
        密码：<input type="password" name="pwd"/><br>
        确认密码：<input type="confirmPassword" name="cpwd"/><br>
        验证码：<input type="code" name="code" /><br>
        <input type="submit" value="提交">
    </form>
</DIV>



</body>
<script type="text/javascript">

    var email = $("#email").val();
    function submit() {
        $.ajax({
            type: "POST",
            url: "http://localhost:8081/code/create/"+ email,
            success: function(result) {
                alert(result);
            }
        });
    }
</script>
</html>